from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker




Base = declarative_base()
engine = create_engine('mysql+pymysql://root:123456@localhost/test')
Base.metadata.create_all(engine)


Session = sessionmaker(bind=engine)
session = Session()


# 创建一个新用户
new_user = User( taskId=1, output='hello', process='a-b-c-d')
session.add(new_user)
session.commit()

# 查询所有用户
users = session.query(User).all()
for user in users:
    print()

# # 查询特定条件的用户
# user = session.query(User).filter_by(name='John').first()
# print(user.name, user.email)

# # 更新用户
# user.name = 'John Doe'
# session.commit()

# # 删除用户
# session.delete(user)
# session.commit()